package com.code.gen.bean.bo;

import java.util.Arrays;
import java.util.List;

import com.code.gen.enums.ECodeGenDatabaseReadType;

import lombok.Data;

/**
 * 代码生成系统属性类
 * 
 * @author liu
 * @date 2022-08-03
 */
@Data
public class CodeGenPropertiesSystem {

    private ECodeGenDatabaseReadType readType = ECodeGenDatabaseReadType.ONLINE;
    private String databaseName = null;
    private String url = "jdbc:mysql://localhost:3306/" + databaseName;
    private String username = "root";
    private String password = "123456";
    // Oracle连接
    // private String DATABASE_NAME = "RAISE_DT";
    // private String URL = "jdbc:oracle:thin:@211.152.57.28:1521:orcl";
    // private String USERNAME = "unionlive";
    // private String PASSWORD = "unionlive";

    /**生成文件的基础路径(classpath:下的文件不受影响)*/
    private String basePath = "com.sojson.project";
    /**模块名(拼在基础路径后面)*/
    private String moduleName = "too";
    /**业务名(拼在模块名后面)*/
    private String businessName = "gen";
    /**数据库表名的前缀,没有不写*/
    private String databaseTablePrefix = "rent_";
    /**是否加数据库表名注解*/
    private boolean databaseTableAnno = false;
    /**Xml的ID参数类型和返回类型,不写为动态(当用统一的ID字段的时候类型可以改变)*/
    private String idXmlParam = "String";
    /**如果读取数据库,要读取的表,没有就读全部*/
    private String[] tables = {"rent_test"};

    /**导包的排序规则,按数组中的位置排序,其他的包在最上面或最下面(按字母顺序排序)*/
    private String[] importSort = {"java", "javax", "org", "com"};
    /**导的其他包在上面还是下面,true:上面,false:下面*/
    private boolean importSortOther = false;
    /**每组包之间是否加换行*/
    private boolean importSortSpacing = true;

    /**作者(代码生成人)*/
    private String author = "liu";

    /**主键字段名*/
    private String id = "id";
    /**编号字段名*/
    private String serialNumber = "no";
    /**删除字段名*/
    private String delFlag = "delFlag";
    /**创建者字段名*/
    private String createBy = "createBy";
    /**创建时间字段名*/
    private String createTime = "createTime";
    /**坐标字段名*/
    private String location = "location";
    /**排序字段名*/
    private List<String> sort = Arrays.asList(new String[] {"sort", "sortNum"});
    /**没有被删除的状态值*/
    private int delNumberNot = 1;
    /**被删除后的状态值*/
    private int delNumber = 2;
    /**是否删除字段的所有状态值*/
    private int[] delNumberList = {delNumberNot, delNumber};
    /**是否生成关于ID的方法*/
    private boolean generateId = true;
    /**是否生成关于编号的方法*/
    private boolean generateSerialNumber = true;
    /**是否生成关于逻辑删除的方法*/
    private boolean generateIsDel = true;
    /**是否生成清空数据的方法*/
    private boolean generateClear = true;

    /**Controller路径是否加.后缀*/
    public boolean controllerMappingSuffix = false;

    /**开启类名驼峰命名映射*/
    public static boolean enableClassMapUnderscoreToCamelCase = true;
    /**开启字段驼峰命名映射*/
    public static boolean enableFieldMapUnderscoreToCamelCase = true;

    /**数据库表是否加前缀后缀*/
    private boolean databasePrefix = true;

    /** 上级菜单ID */
    private String parentMenuId = "0";
    /** 创建人ID */
    private String creatrById = "1";

    /**不添加的字段(这些字段都在父类中)*/
    private List<String> noFields =
        Arrays.asList(new String[] {createBy, createTime, "updateBy", "updateTime", delFlag});
    /**作为查询条件的字段*/
    private List<String> queryFields = Arrays.asList(new String[] {});
    /**不作为查询条件的字段*/
    private List<String> queryNoFields = Arrays.asList(new String[] {delFlag, location});
    /**作为返回值的字段*/
    private List<String> resultFields = Arrays.asList(new String[] {});
    /**不作为返回值的字段*/
    private List<String> resultNoFields = Arrays.asList(new String[] {delFlag});
    /**前段不添加和修改的字段*/
    private List<String> viewNoAddEdit =
        Arrays.asList(new String[] {createBy, createTime, "updateBy", "updateTime", delFlag});
    /**前段不作为查询条件的字段*/
    private List<String> viewNoQuery =
        Arrays.asList(new String[] {createBy, "updateBy", "updateTime", delFlag, location});
    /**前段不作为列表展示的字段*/
    private List<String> viewNoList = Arrays.asList(new String[] {createBy, "updateBy", "updateTime", delFlag});

}